﻿<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <!-- Brushes -->
  <DrawingBrush x:Key="DrawCanvasBackground" Viewport="0,0,20,20" ViewportUnits="Absolute" TileMode="Tile">
    <DrawingBrush.Drawing>
      <DrawingGroup>
        <GeometryDrawing Brush="#FF333333">
          <GeometryDrawing.Geometry>
            <RectangleGeometry Rect="0,0,20,20"/>
          </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing Brush="#08FFFFFF">
          <GeometryDrawing.Geometry>
            <RectangleGeometry Rect="0,0,10,10"/>
          </GeometryDrawing.Geometry>
        </GeometryDrawing>
        <GeometryDrawing Brush="#08FFFFFF">
          <GeometryDrawing.Geometry>
            <RectangleGeometry Rect="10,10,10,10"/>
          </GeometryDrawing.Geometry>
        </GeometryDrawing>
      </DrawingGroup>
    </DrawingBrush.Drawing>
  </DrawingBrush>

  <!--<Style TargetType="{x:Type TextBlock}">
    <Setter Property="FontFamily" Value="Segoe UI, Consolas, Arial, MSYH"/>
  </Style>-->

  <!-- TextBox Style -->
  <Style TargetType="{x:Type TextBox}">
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Background" Value="#FF333333"/>
    <Setter Property="BorderBrush" Value="#FF1A1A1A"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Padding" Value="1"/>
    <Setter Property="AllowDrop" Value="true"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TextBox}">
          <Border x:Name="Bd" SnapsToDevicePixels="True" CornerRadius="2,2,2,2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
            <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type Button}">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF6D6D6D" Offset="0"/>
          <GradientStop Color="#FF595959" Offset="1"/>
          <GradientStop Color="#FF595959" Offset="0.522"/>
          <GradientStop Color="#FE626262" Offset="0.478"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="BorderBrush" Value="#FF333333"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Padding" Value="1"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Border x:Name="Chrome" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#FFAAAAAA" Offset="0"/>
              <GradientStop Color="#FF818181" Offset="1"/>
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="Background">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#FF424242" Offset="0"/>
              <GradientStop Color="#FF515151" Offset="1"/>
              <GradientStop Color="#FF4B4B4B" Offset="0.522"/>
              <GradientStop Color="#FF424242" Offset="0.478"/>
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!-- TreeView Style -->
  <Style TargetType="{x:Type TreeView}">
    <Setter Property="Background" Value="#00333333"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
  </Style>

  <Style x:Key="TreeViewItemExpander" TargetType="{x:Type ToggleButton}">
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="Width" Value="19"/>
    <Setter Property="Height" Value="13"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Border Width="19" Height="13" Background="Transparent">
            <Border SnapsToDevicePixels="True" Width="10" Height="10" CornerRadius="5" Background="#FF595959">
              <Path x:Name="ExpandPath" Fill="#FFAAAAAA" Data="M1 0 L6 3 1 6z" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            </Border>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="ExpandPath" Property="Data" Value="M0 1 L6 1 3 6z"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="ExpandPath" Property="Fill" Value="#FFFFFFFF"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type TreeViewItem}">
    <Setter Property="Background" Value="#FF424242"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="Padding" Value="1,1,0,1"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TreeViewItem}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition MinWidth="19" Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition/>
            </Grid.RowDefinitions>
            <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" Grid.RowSpan="1" Grid.ColumnSpan="3" Margin="-200,0,0,1" HorizontalAlignment="Right" MinWidth="{Binding Path=ViewportWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}" Width="{Binding Path=ExtentWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}" CornerRadius="2,2,2,2"/>
            <ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource TreeViewItemExpander}"/>
            <Grid SnapsToDevicePixels="True" Grid.Column="1">
              <ContentPresenter x:Name="PART_Header" ContentSource="Header" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
            </Grid>
            <ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsExpanded" Value="False">
              <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="HasItems" Value="False">
              <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
              <Setter Property="Foreground" Value="#FF333333"/>
              <Setter Property="Background" TargetName="Bd">
                <Setter.Value>
                  <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="#FFE2E2E2" Offset="0"/>
                    <GradientStop Color="#FF9C9C9C" Offset="1"/>
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Scroll Bar Style -->
  <Style TargetType="{x:Type ScrollViewer}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid x:Name="Grid" Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" FocusVisualStyle="{x:Null}" Margin="{TemplateBinding Padding}" Grid.Column="0" Grid.Row="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False"/>
            <ScrollBar x:Name="PART_VerticalScrollBar" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Cursor="Arrow" Grid.Column="1" Grid.Row="0" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="VerticalScrollBar"/>
            <ScrollBar x:Name="PART_HorizontalScrollBar" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="HorizontalScrollBar"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Grid>
            <Path x:Name="Arrow" Stretch="Fill" Data="M5,0L10,10 0,10z" RenderTransformOrigin="0.5,0.5" Margin="5,5,5,5" Fill="#FF808080" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Fill" TargetName="Arrow" Value="#FF5C5C5C"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="Arrow" Property="Fill" Value="#FFDCDCDC"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="Arrow" Property="Fill" Value="#FF333333"/>
            </Trigger>
            <Trigger Property="Tag" Value="DownArrow">
              <Setter TargetName="Arrow" Property="RenderTransform">
                <Setter.Value>
                  <RotateTransform Angle="180"/>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="Tag" Value="LeftArrow">
              <Setter TargetName="Arrow" Property="RenderTransform">
                <Setter.Value>
                  <RotateTransform Angle="-90"/>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="Tag" Value="RightArrow">
              <Setter TargetName="Arrow" Property="RenderTransform">
                <Setter.Value>
                  <RotateTransform Angle="90"/>
                </Setter.Value>
              </Setter>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Rectangle x:Name="Bg" Fill="{TemplateBinding Background}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Grid Background="Transparent">
            <Rectangle Margin="{TemplateBinding Padding}" Fill="#FF808080" RadiusX="4" RadiusY="4" x:Name="rectangle"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Fill" TargetName="rectangle" Value="#FFDCDCDC"/>
            </Trigger>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Fill" TargetName="rectangle" Value="#FF333333"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="{x:Type ScrollBar}">
    <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
    <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
          <GradientStop Color="#FF414141" Offset="0"/>
          <GradientStop Color="#FF4F4F4F" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollBar}">
          <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
            <Grid.RowDefinitions>
              <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
              <RowDefinition Height="0.00001*"/>
              <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
            </Grid.RowDefinitions>
            <RepeatButton Style="{StaticResource ScrollBarButton}" Command="{x:Static ScrollBar.LineUpCommand}" Tag="UpArrow"/>
            <Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="true">
              <Track.DecreaseRepeatButton>
                <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="{x:Static ScrollBar.PageUpCommand}"/>
              </Track.DecreaseRepeatButton>
              <Track.IncreaseRepeatButton>
                <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="{x:Static ScrollBar.PageDownCommand}"/>
              </Track.IncreaseRepeatButton>
              <Track.Thumb>
                <Thumb Padding="5,0,5,0" Style="{StaticResource ScrollBarThumb}"/>
              </Track.Thumb>
            </Track>
            <RepeatButton Style="{StaticResource ScrollBarButton}" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" Tag="DownArrow"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="Background">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
              <GradientStop Color="#FF414141" Offset="0"/>
              <GradientStop Color="#FF4F4F4F" Offset="1"/>
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
        <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type ScrollBar}">
              <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                  <ColumnDefinition Width="0.00001*"/>
                  <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                </Grid.ColumnDefinitions>
                <RepeatButton Style="{StaticResource ScrollBarButton}" Command="{x:Static ScrollBar.LineLeftCommand}" Tag="LeftArrow"/>
                <Track x:Name="PART_Track" Grid.Column="1">
                  <Track.DecreaseRepeatButton>
                    <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="{x:Static ScrollBar.PageLeftCommand}"/>
                  </Track.DecreaseRepeatButton>
                  <Track.IncreaseRepeatButton>
                    <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="{x:Static ScrollBar.PageRightCommand}"/>
                  </Track.IncreaseRepeatButton>
                  <Track.Thumb>
                    <Thumb Padding="0,5,0,5" Style="{StaticResource ScrollBarThumb}"/>
                  </Track.Thumb>
                </Track>
                <RepeatButton Style="{StaticResource ScrollBarButton}" Grid.Column="2" Command="{x:Static ScrollBar.LineRightCommand}" Tag="RightArrow"/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!-- ComboBox Style -->
  <Style x:Key="ComboBoxTransparentButtonStyle" TargetType="{x:Type ToggleButton}">
    <Setter Property="MinWidth" Value="0"/>
    <Setter Property="MinHeight" Value="0"/>
    <Setter Property="Width" Value="Auto"/>
    <Setter Property="Height" Value="Auto"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="ClickMode" Value="Press"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton"/>
            </Grid.ColumnDefinitions>
            <Rectangle Grid.Column="1" Width="15" Height="15" Fill="#FF808080" RadiusX="2" RadiusY="2" x:Name="rectangle"/>
            <Path Grid.Column="1" Width="8.5" Height="5" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" StrokeThickness="2" Stroke="#FFE1E1E1" Data="M0,0 L4,4 8,0"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Fill" TargetName="rectangle" Value="#FFAAAAAA"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="AllowDrop" Value="true"/>
    <Setter Property="MinWidth" Value="0"/>
    <Setter Property="MinHeight" Value="0"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TextBox}">
          <ScrollViewer Focusable="false" Background="Transparent" x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
    <Grid SnapsToDevicePixels="true">
      <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
        <Grid Grid.IsSharedSizeScope="true">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton"/>
          </Grid.ColumnDefinitions>
          <TextBox HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="PART_EditableTextBox" Style="{StaticResource ComboBoxEditableTextBox}" Grid.Column="1" IsReadOnly="{Binding Path=IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"/>
          <ToggleButton Background="{x:Null}" Style="{StaticResource ComboBoxTransparentButtonStyle}" Grid.ColumnSpan="3" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
        </Grid>
      </Border>
      <Popup Focusable="false" AllowsTransparency="true" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" x:Name="PART_Popup">
        <Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
          <ScrollViewer>
            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
          </ScrollViewer>
        </Border>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="HasItems" Value="false">
        <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
        <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
      </Trigger>
      <Trigger Property="IsGrouping" Value="true">
        <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type ComboBox}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Background" Value="#FF333333"/>
    <Setter Property="Padding" Value="1"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ComboBox}">
          <Grid SnapsToDevicePixels="True">
            <Border x:Name="Bd" Background="{TemplateBinding Background}" Padding="1" CornerRadius="2,2,2,2">
              <Grid Grid.IsSharedSizeScope="True">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="1"/>
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton"/>
                </Grid.ColumnDefinitions>
                <Border x:Name="SelectedItemBorder" Grid.ColumnSpan="2"/>
                <ContentPresenter Margin="0,-1,0,-1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
                <ToggleButton Style="{StaticResource ComboBoxTransparentButtonStyle}" Grid.ColumnSpan="3" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
              </Grid>
            </Border>
            <Popup Focusable="false" AllowsTransparency="true" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" x:Name="PART_Popup">
              <Border x:Name="DropDownBorder" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" Background="{TemplateBinding Background}">
                <ScrollViewer>
                  <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                </ScrollViewer>
              </Border>
            </Popup>
          </Grid>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsSelectionBoxHighlighted" Value="true"/>
                <Condition Property="IsDropDownOpen" Value="false"/>
              </MultiTrigger.Conditions>
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
            </MultiTrigger>
            <Trigger Property="HasItems" Value="false">
              <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
              <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsGrouping" Value="true">
              <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsEditable" Value="true">
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Padding" Value="0,1"/>
        <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="{x:Static ToolBar.ComboBoxStyleKey}" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
    <!-- Emtpy -->
  </Style>

  <Style TargetType="{x:Type ComboBoxItem}">
    <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="Padding" Value="3,0,3,0"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Background" Value="#FF424242"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
          <Border x:Name="Bd" SnapsToDevicePixels="true" Margin="2,1,2,1"  Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="2,2,2,2">
            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="true">
              <Setter Property="Foreground" Value="#FF333333"/>
              <Setter Property="Background" TargetName="Bd">
                <Setter.Value>
                  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFE0E0DB" Offset="0"/>
                    <GradientStop Color="#FF9B9B9B" Offset="1"/>
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Menu Style -->
  <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Separator}">
          <Grid SnapsToDevicePixels="true" Margin="0,2,0,2">
            <Rectangle Margin="1,0,1,0" Height="1" Fill="#FFF0F0F0"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type Menu}">
    <Setter Property="Background" Value="#FF3A3A3A"/>
    <Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
    <Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
    <Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
    <Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Menu}">
          <Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <PathGeometry x:Key="Checkmark" Figures="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z"/>
  <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    <Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
          <ColumnDefinition Width="14"/>
        </Grid.ColumnDefinitions>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
        <Path Visibility="Hidden" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True"/>
        <TextBlock Margin="5,2,0,2" x:Name="InputGestureText" Text="{TemplateBinding InputGestureText}" Grid.Column="2" DockPanel.Dock="Right"/>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsChecked" Value="true">
        <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsHighlighted" Value="true">
        <Setter Property="Background" TargetName="Bd" Value="#FFAAAAAA"/>
        <Setter Property="Foreground" Value="#FF333333"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
  <Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
    <Setter Property="ClickMode" Value="Hover"/>
    <Setter Property="MinWidth" Value="0"/>
    <Setter Property="MinHeight" Value="0"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <DockPanel SnapsToDevicePixels="true" Background="Transparent">
            <Rectangle x:Name="R1" Width="1" Fill="Transparent" DockPanel.Dock="Right"/>
            <Rectangle x:Name="B1" Height="1" Fill="Transparent" DockPanel.Dock="Bottom"/>
            <Rectangle x:Name="L1" Width="1" Fill="Transparent" DockPanel.Dock="Left"/>
            <Rectangle x:Name="T1" Height="1" Fill="Transparent" DockPanel.Dock="Top"/>
            <ContentPresenter HorizontalAlignment="Center" Margin="2,2,2,2" x:Name="ContentContainer" VerticalAlignment="Center"/>
          </DockPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="Fill" TargetName="R1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
              <Setter Property="Fill" TargetName="B1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
              <Setter Property="Fill" TargetName="L1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
              <Setter Property="Fill" TargetName="T1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
              <Setter Property="Margin" TargetName="ContentContainer" Value="3,3,1,1"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
  <Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
  <Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
    <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
    <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid SnapsToDevicePixels="true">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border Grid.Column="0" Grid.Row="1">
              <ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
            </Border>
            <RepeatButton Focusable="false" Style="{StaticResource MenuScrollButton}" Grid.Column="0" Grid.Row="0" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                  <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                  <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                  <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                  <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource UpArrow}"/>
            </RepeatButton>
            <RepeatButton Focusable="false" Style="{StaticResource MenuScrollButton}" Grid.Column="0" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                  <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                  <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                  <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                  <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource DownArrow}"/>
            </RepeatButton>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    <Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <DockPanel>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
        <Path Visibility="Collapsed" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="Header" RecognizesAccessKey="True"/>
        <Popup Focusable="false" AllowsTransparency="true" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" x:Name="PART_Popup">
          <Border x:Name="SubMenuBorder" Background="#FF3A3A3A" BorderBrush="#FFF0F0F0" BorderThickness="1">
            <ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
              <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
            </ScrollViewer>
          </Border>
        </Popup>
      </DockPanel>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsSuspendingPopupAnimation" Value="true">
        <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
      </Trigger>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsChecked" Value="true">
        <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsHighlighted" Value="true">
        <Setter Property="Background" TargetName="Bd" Value="#FFAAAAAA"/>
        <Setter Property="Foreground" Value="#FF333333"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    <Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <DockPanel>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
        <Path Visibility="Collapsed" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="Header" RecognizesAccessKey="True"/>
      </DockPanel>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsChecked" Value="true">
        <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsHighlighted" Value="true">
        <Setter Property="Background" TargetName="Bd" Value="#FFAAAAAA"/>
        <Setter Property="Foreground" Value="#FF333333"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
  <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    <Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
          <ColumnDefinition Width="14"/>
        </Grid.ColumnDefinitions>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
        <Path Visibility="Hidden" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True"/>
        <Path Margin="4,0,6,0" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Grid.Column="3" DockPanel.Dock="Right" Data="{StaticResource RightArrow}"/>
        <Popup Focusable="false" AllowsTransparency="true" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-3" x:Name="PART_Popup">
          <Border x:Name="SubMenuBorder" Background="#FF3A3A3A" BorderBrush="#FFF0F0F0" BorderThickness="1">
            <ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
              <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
            </ScrollViewer>
          </Border>
        </Popup>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsSuspendingPopupAnimation" Value="true">
        <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
      </Trigger>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsChecked" Value="true">
        <Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
        <Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
      </Trigger>
      <Trigger Property="IsHighlighted" Value="True">
        <Setter Property="Background" TargetName="Bd" Value="#FFAAAAAA"/>
        <Setter Property="Foreground" Value="#FF333333"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type MenuItem}">
    <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    <Style.Triggers>
      <Trigger Property="Role" Value="TopLevelHeader">
        <Setter Property="Margin" Value="0,1,0,1"/>
        <Setter Property="Padding" Value="6,3,6,3"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
      </Trigger>
      <Trigger Property="Role" Value="TopLevelItem">
        <Setter Property="Margin" Value="0,1,0,1"/>
        <Setter Property="Padding" Value="6,3,6,3"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
      </Trigger>
      <Trigger Property="Role" Value="SubmenuHeader">
        <Setter Property="DockPanel.Dock" Value="Top"/>
        <Setter Property="Padding" Value="0,2,0,2"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
      </Trigger>
      <Trigger Property="Role" Value="SubmenuItem">
        <Setter Property="DockPanel.Dock" Value="Top"/>
        <Setter Property="Padding" Value="0,2,0,2"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!-- Expander Style -->
  <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Border Padding="{TemplateBinding Padding}">
            <Grid SnapsToDevicePixels="False" Background="Transparent">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="15"/>
                <ColumnDefinition Width="*"/>
              </Grid.ColumnDefinitions>
              <Path x:Name="arrow" SnapsToDevicePixels="False" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="0" Data="M 0,0  L 5,5  L 0,10z" Fill="#FFAAAAAA"/>
              <ContentPresenter x:Name="ContentSite" SnapsToDevicePixels="True" HorizontalAlignment="Left" Margin="4,0,0,0" VerticalAlignment="Center" Grid.Column="1" RecognizesAccessKey="True"/>
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="true">
              <Setter Property="Data" TargetName="arrow" Value="M 0,0 L 5,5 L 10,0z"/>
            </Trigger>
            <Trigger SourceName="ContentSite" Property="Content" Value="{x:Null}">
              <Setter TargetName="ContentSite" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="true">
              <Setter Property="Fill" TargetName="arrow" Value="#FFF0F0F0"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="{x:Type Expander}">
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Background" Value="#FF595959"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Expander}">
          <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
            <DockPanel>
              <ToggleButton x:Name="HeaderSite" FocusVisualStyle="{x:Null}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="1" MinHeight="0" MinWidth="0" Style="{StaticResource ExpanderDownHeaderStyle}" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" DockPanel.Dock="Top" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
              <ContentPresenter Focusable="False" Visibility="Collapsed" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="ExpandSite" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" DockPanel.Dock="Bottom"/>
            </DockPanel>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsExpanded" Value="True">
              <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Grid Splitter Style -->
  <Style x:Key="GridSplitterPreviewStyle">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Fill="#80000000"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="{x:Type GridSplitter}">
    <Setter Property="Background" Value="#FF333333"/>
    <Setter Property="PreviewStyle" Value="{StaticResource GridSplitterPreviewStyle}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type GridSplitter}">
          <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- StatusBar Style -->
  <Style TargetType="{x:Type StatusBar}">
    <Setter Property="Background" Value="#FF3A3A3A"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="BorderBrush" Value="#FF1A1A1A"/>
    <Setter Property="BorderThickness" Value="0,1,0,0"/>
  </Style>

  <!-- CheckBox Style -->
  <Style TargetType="{x:Type CheckBox}">
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Background" Value="#00000000"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CheckBox}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="16"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border x:Name="border" Width="12" Height="12" BorderThickness="1,1,1,1" BorderBrush="#FF333333" Background="#FF666666" ScrollViewer.CanContentScroll="True">
              <Path x:Name="path" Width="9.208" Height="6.198" Stretch="Fill" Stroke="#FFFFFFFF" Data="M5.52,5.375 L8.53,8.385 13.727499,3.1874998" StrokeThickness="1.5" Visibility="Collapsed"/>
            </Border>
            <ContentPresenter Grid.Column="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="BorderBrush" TargetName="border" Value="#FFE5E5E5"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
              <Setter Property="Visibility" TargetName="path" Value="Visible"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Toolbar Style -->
  <Style TargetType="{x:Type ToolBarTray}">
    <Setter Property="Background" Value="#FF333333"/>
  </Style>

  <Style TargetType="{x:Type ToolBar}">
    <Setter Property="Background" Value="#FF424242"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToolBar}">
          <Grid x:Name="Grid" SnapsToDevicePixels="True" Margin="0,2,0,2">
            <Border x:Name="MainPanelBorder" Margin="0,0,3,0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,3,3" Padding="{TemplateBinding Padding}">
              <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
                <ContentPresenter x:Name="ToolBarHeader" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Center" Margin="0,0,4,0" VerticalAlignment="Center" ContentSource="Header"/>
                <ToolBarPanel x:Name="PART_ToolBarPanel" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="0,0,0,0" IsItemsHost="true"/>
              </DockPanel>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="Header" Value="{x:Null}">
              <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
              <Setter TargetName="Grid" Property="Margin" Value="2,0,2,0"/>
              <Setter TargetName="ToolBarHeader" Property="Margin" Value="0,0,0,4"/>
              <Setter TargetName="PART_ToolBarPanel" Property="Margin" Value="0,0,0,0"/>
              <Setter TargetName="ToolBarHeader" Property="DockPanel.Dock" Value="Top"/>
              <Setter TargetName="MainPanelBorder" Property="Margin" Value="0,0,0,3"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" TargetType="{x:Type Button}">
    <!--<Setter Property="Width" Value="32"/>
    <Setter Property="Height" Value="32"/>-->
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Padding" Value="2"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Background" Value="#FF424242"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="HorizontalAlignment" Value="Center"/>
    <Setter Property="VerticalAlignment" Value="Center"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="3">
            <ContentPresenter x:Name="content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Border>
          <ControlTemplate.Triggers>
            <!--<Trigger Property="IsChecked" Value="True">
              <Setter TargetName="Bd" Property="Background" Value="#FFAAAAAA"/>
            </Trigger>-->
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="Bd" Property="Background" Value="#FF707070"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter TargetName="Bd" Property="Background" Value="#FF424242"/>
              <Setter TargetName="content" Property="Opacity" Value="0.5"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Slider Style -->
  <Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="IsTabStop" Value="false"/>
    <Setter Property="Focusable" Value="false"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="{TemplateBinding Background}" CornerRadius="3,0,0,3"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="HorizontalSliderThumbStyle" TargetType="{x:Type Thumb}">
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Height" Value="18"/>
    <Setter Property="Width" Value="5"/>
    <Setter Property="Foreground" Value="Gray"/>
    <Setter Property="Cursor" Value="SizeWE"/>
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF848484" Offset="0"/>
          <GradientStop Color="#FF666666" Offset="1"/>
          <GradientStop Color="#FF666666" Offset="0.194"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border SnapsToDevicePixels="True" BorderBrush="#FF1A1A1A" BorderThickness="0,0,1,0" Background="{TemplateBinding Background}" CornerRadius="0,3,3,0"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="{x:Type Slider}">
    <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF5B5B5B" Offset="0"/>
          <GradientStop Color="#FF333333" Offset="1"/>
          <GradientStop Color="#FF333333" Offset="0.194"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="BorderBrush" Value="#FF1A1A1A"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Slider}">
          <Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
            <Grid>
              <Track x:Name="PART_Track">
                <Track.DecreaseRepeatButton>
                  <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.DecreaseLarge}">
                    <RepeatButton.Background>
                      <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF848484" Offset="0"/>
                        <GradientStop Color="#FF666666" Offset="0.194"/>
                        <GradientStop Color="#FF666666" Offset="1"/>
                      </LinearGradientBrush>
                    </RepeatButton.Background>
                  </RepeatButton>
                </Track.DecreaseRepeatButton>
                <Track.IncreaseRepeatButton>
                  <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.IncreaseLarge}"/>
                </Track.IncreaseRepeatButton>
                <Track.Thumb>
                  <Thumb x:Name="Thumb" Style="{StaticResource HorizontalSliderThumbStyle}"/>
                </Track.Thumb>
              </Track>
              <Label IsHitTestVisible="False" HorizontalAlignment="Left" VerticalAlignment="Center" Content="{TemplateBinding Value}" Padding="5,0,5,0" Foreground="{TemplateBinding Foreground}"/>
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsSelectionRangeEnabled" Value="true"/>
            <Trigger Property="IsKeyboardFocused" Value="True">
              <Setter Property="Foreground" TargetName="Thumb" Value="Blue"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Customized Style -->
  <Style x:Key="CHomeTreeExpander" TargetType="{x:Type Expander}">
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="Background" Value="#FF595959"/>
    <Setter Property="IsExpanded" Value="True"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Expander}">
          <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5">
            <DockPanel>
              <ToggleButton x:Name="HeaderSite" IsEnabled="False" FocusVisualStyle="{x:Null}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="1" MinHeight="0" MinWidth="0" Style="{StaticResource ExpanderDownHeaderStyle}" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" DockPanel.Dock="Top" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
              <Border x:Name="ExpandSite" Background="#FF333333" CornerRadius="3" Margin="4,0,4,4">
                <ContentPresenter Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" DockPanel.Dock="Bottom"/>
              </Border>
            </DockPanel>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsExpanded" Value="False">
              <Setter TargetName="HeaderSite" Property="Content" Value="{x:Null}"/>
              <Setter TargetName="HeaderSite" Property="Height" Value="{Binding Path=ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"/>
              <Setter TargetName="ExpandSite" Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <DataTemplate x:Key="EditModeItemTemplate">
    <Border x:Name="Background" Width="17" Background="#FF424242" Margin="0,0,0,2" CornerRadius="0,3,3,0" Padding="0,3,0,3">
      <TextBlock Text="{Binding Path=.}">
        <TextBlock.LayoutTransform>
          <RotateTransform Angle="90"/>
        </TextBlock.LayoutTransform>
      </TextBlock>
    </Border>
    <DataTemplate.Triggers>
      <Trigger SourceName="Background" Property="IsMouseOver" Value="True">
        <Setter TargetName="Background" Property="Background" Value="#FFAAAAAA"/>
      </Trigger>
      <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
        <Setter TargetName="Background" Property="Background" Value="#FF808080"/>
      </DataTrigger>
    </DataTemplate.Triggers>
  </DataTemplate>

  <DataTemplate x:Key="OpenedFormItemTemplate">
    <Border x:Name="Background" Margin="0,0,2,0" CornerRadius="3,3,0,0" Padding="3,2">
      <Border.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF3B3B3B" Offset="0"/>
          <GradientStop Color="#FF333333" Offset="1"/>
        </LinearGradientBrush>
      </Border.Background>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBlock Text="{Binding Path=Name}"/>
        <Button Grid.Column="1" Command="{Binding CloseCommand}" CommandParameter="{Binding .}" HorizontalAlignment="Center" VerticalAlignment="Center">
          <Button.Template>
            <ControlTemplate TargetType="{x:Type Button}">
              <!--<Border Background="#80424242" BorderBrush="#FFCCCCCC" BorderThickness="1" CornerRadius="2" Margin="5,0,2,0" Padding="2">
                <Path Data="M0,0L5,5M5,0L0,5" Stroke="#FFCCCCCC" StrokeThickness="1"/>
              </Border>-->
              <Grid Margin="5,0,2,0" Background="Transparent">
                <Path Data="M0,0L9,9M9,0L0,9" Width="9" Height="9" Stroke="#FF333333" StrokeThickness="3.5"/>
                <Path Data="M0,0L7,7M7,0L0,7" Width="7" Height="7" Stroke="#FFCCCCCC" StrokeThickness="1.5"/>
              </Grid>
            </ControlTemplate>
          </Button.Template>
        </Button>
      </Grid>
    </Border>
    <DataTemplate.Triggers>
      <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
        <Setter TargetName="Background" Property="Background" Value="#FF595959"/>
      </DataTrigger>
      <!--<Trigger SourceName="Background" Property="IsMouseOver" Value="True">
        <Setter TargetName="Background" Property="Background">
          <Setter.Value>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#FF5B5B5B" Offset="0"/>
              <GradientStop Color="#FF333333" Offset="1"/>
            </LinearGradientBrush>
          </Setter.Value>
        </Setter>
      </Trigger>-->
    </DataTemplate.Triggers>
  </DataTemplate>

  <Style x:Key="TablikeListBoxStyle" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="#FF333333"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="ItemContainerStyle">
      <Setter.Value>
        <Style TargetType="{x:Type ListBoxItem}">
          <Setter Property="Background" Value="Transparent"/>
          <Setter Property="Padding" Value="0,0,0,0"/>
          <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate TargetType="{x:Type ListBoxItem}">
                <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                  <ContentPresenter ContentTemplate="{Binding ItemTemplate, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Border>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBox}">
          <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- List Box Style -->
  <Style TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="#FF333333"/>
    <Setter Property="BorderBrush" Value="#FF333333"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBox}">
          <Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2,2,2,2">
            <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
              <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
            </ScrollViewer>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsGrouping" Value="True">
              <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style TargetType="{x:Type ListBoxItem}">
    <Setter Property="Padding" Value="1,1,1,1"/>
    <Setter Property="Background" Value="#FF424242"/>
    <Setter Property="BorderBrush" Value="#00333333"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Foreground" Value="#FFF0F0F0"/>
    <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBoxItem}">
          <Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="2,2,2,2">
            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsSelected" Value="True">
              <Setter Property="Foreground" Value="#FF333333"/>
              <Setter Property="Background" TargetName="Bd">
                <Setter.Value>
                  <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="#FFE2E2E2" Offset="0"/>
                    <GradientStop Color="#FF9C9C9C" Offset="1"/>
                  </LinearGradientBrush>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>